const NMWirelessDeviceItem = GObject.registerClass({
Properties: {
+ 'is-hotspot': GObject.ParamSpec.boolean('is-hotspot', '', '',
+ GObject.ParamFlags.READABLE,
+ false),
'single-device-mode': GObject.ParamSpec.boolean('single-device-mode', '', '',
GObject.ParamFlags.READWRITE,
false),
'notify::active-access-point', this._activeApChanged.bind(this),
'notify::active-connection', () => this._activeConnectionChanged(),
'notify::available-connections', () => this._availableConnectionsChanged(),
+ 'state-changed', () => this.notify('is-hotspot'),
'access-point-added', (d, ap) => {
this._addAccessPoint(ap);
this._updateItemsVisibility();
return 'network-wireless-acquiring-symbolic';
case NM.ActiveConnectionState.ACTIVATED: {
- if (this._isHotSpotMaster())
+ if (this.is_hotspot)
return 'network-wireless-hotspot-symbolic';
if (!this._canReachInternet())
}
get name() {
- if (this._isHotSpotMaster())
+ if (this.is_hotspot)
/* Translators: %s is a network identifier */
return _('%s Hotspot').format(this._deviceName);
return this._deviceName;
}
+ get is_hotspot() {
+ if (!this._device.active_connection)
+ return false;
+
+ const {connection} = this._device.active_connection;
+ if (!connection)
+ return false;
+
+ let ip4config = connection.get_setting_ip4_config();
+ if (!ip4config)
+ return false;
+
+ return ip4config.get_method() === NM.SETTING_IP4_CONFIG_METHOD_SHARED;
+ }
+
_activeApChanged() {
this._activeAccessPoint?.disconnectObject(this);
this._activeAccessPoint = this._device.active_access_point;
return this._client.connectivity === NM.ConnectivityState.FULL;
}
-
- _isHotSpotMaster() {
- if (!this._device.active_connection)
- return false;
-
- let connection = this._device.active_connection.connection;
- if (!connection)
- return false;
-
- let ip4config = connection.get_setting_ip4_config();
- if (!ip4config)
- return false;
-
- return ip4config.get_method() === NM.SETTING_IP4_CONFIG_METHOD_SHARED;
- }
});
const NMVpnConnectionItem = GObject.registerClass({